// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 
// Source File Name:   Right.java

package com.oa.workflow;

import com.oa.database.DataConn;
import java.io.PrintStream;
import java.sql.*;
import java.util.*;

// Referenced classes of package com.oa.workflow:
//            RightInfor

public class Right
{

    private DataConn dataConn;
    private Connection conn;
    private Statement stmt;
    private ResultSet rs;
    private String sSQL;
    private String sYGID;
    private ArrayList arrayList;

    public Right(String userid)
    {
        dataConn = null;
        conn = null;
        stmt = null;
        rs = null;
        sSQL = "";
        sYGID = "";
        arrayList = null;
        dataConn = new DataConn();
        conn = dataConn.getConnection();
        sYGID = userid;
    }

    public Collection getRightInforList()
    {
        try
        {
            stmt = conn.createStatement();
            arrayList = new ArrayList();
            RightInfor rightInfor = new RightInfor();
            sSQL = "select GZLID,XXID from OA_GZL_QX where YGIDS like '%," + sYGID + ",%'";
            for(rs = stmt.executeQuery(sSQL); rs.next(); arrayList.add(rightInfor))
            {
                rightInfor = new RightInfor();
                rightInfor.setGZLID(rs.getInt("GZLID"));
                rightInfor.setXXID(rs.getInt("XXID"));
            }

            rs.close();
            stmt.close();
        }
        catch(Exception e)
        {
            System.err.println(e.getMessage());
        }
        finally
        {
            if(dataConn != null)
                dataConn.close();
        }
        return arrayList;
    }

    public static void main(String args[])
    {
        Right r = new Right("1");
        Iterator i = r.getRightInforList().iterator();
        RightInfor ri = new RightInfor();
        for(; i.hasNext(); System.out.println("XXID:" + ri.getXXID()))
        {
            ri = (RightInfor)i.next();
            System.out.println("GZLID:" + ri.getGZLID());
        }

    }

    public ArrayList getArrayList()
    {
        return arrayList;
    }
}
